package com.example.cinema.bindingdata;

import android.view.View;
import android.widget.ImageView;

import androidx.databinding.BindingAdapter;
import androidx.databinding.ObservableField;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.cinema.R;

//分类页数据
public class TypeGridData {

    @BindingAdapter("simgurl")
    public static void setimage(View view,String url)
    {
        if(url!=null)
        {
            RequestOptions options = new RequestOptions()
                    .placeholder(R.mipmap.defaut_img)
                    .error(R.mipmap.defaut_img)
                    .fallback(R.mipmap.defaut_img);
            Glide.with(view).load(url)
                    .apply(options)
                    .into((ImageView) view);
        }

    }

    public ObservableField<String> title = new ObservableField<>();//片名
    public ObservableField<String> times = new ObservableField<>();//时长
    public ObservableField<String> tages = new ObservableField<>();//影片标记
    public ObservableField<String> image = new ObservableField<>();//图片


}
